//
//  ViewController.m
//  XMSDWebImage
//
//  Created by lishi on 2019/5/13.
//  Copyright © 2019 lishi. All rights reserved.
//

#import "ViewController.h"

// Libs
#import "UIImageView+WebCache.h"

#define kSCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define kSCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height

typedef NSDictionary <NSString *, id> XMDictcontent;

@interface ViewController ()

// 静态图
@property (nonatomic, strong) UIImageView *sdImageView;

// gif图
@property (nonatomic, strong) UIImageView *sdGIFImageView;

@end

@implementation ViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 静态图
    [self.view addSubview:self.sdImageView];
    NSString *imageUrl = @"http://pic15.nipic.com/20110628/1369025_192645024000_2.jpg";
    [self.sdImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",imageUrl]] placeholderImage:nil];
    
    // GIF图
    [self.view addSubview:self.sdGIFImageView];
    NSString *imageGIFUrl = @"http://t1.qpic.cn/mblogpic/159cdfb0ed979f038c62/460";
    [self.sdGIFImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",imageGIFUrl]] placeholderImage:nil];
}

- (UIImageView *)sdGIFImageView {
    if (!_sdGIFImageView) {
        _sdGIFImageView = [[UIImageView alloc] initWithFrame:CGRectMake(30, CGRectGetMaxY(self.sdImageView.frame) + 20, kSCREEN_WIDTH - 60, 200)];
        _sdGIFImageView.contentMode = UIViewContentModeScaleAspectFill;
        _sdGIFImageView.clipsToBounds = YES;
    }
    return _sdGIFImageView;
}

- (UIImageView *)sdImageView {
    if (!_sdImageView) {
        _sdImageView = [[UIImageView alloc] initWithFrame:CGRectMake(30,50, kSCREEN_WIDTH - 60, 200)];
        _sdImageView.contentMode = UIViewContentModeScaleAspectFill;
        _sdImageView.clipsToBounds = YES;
    }
    return _sdImageView;
}


@end
